# core/settings.py
"""
Author: didiplus
Description: 应用配置设置
Date: 2025-08-20 22:38:23
LastEditors: didiplus
LastEditTime: 2025-08-20 22:38:24
FilePath: /WeChatBot/app/core/settings.py
Version: 1.0
"""
import os
from typing import Optional
from dotenv import load_dotenv

load_dotenv()

class Settings:
    """
    应用配置设置类
    """
    # 应用配置
    APP_TITLE: str = os.getenv("APP_TITLE", "关键词匹配系统")
    APP_DESCRIPTION: str = os.getenv("APP_DESCRIPTION", "基于FastAPI的关键词匹配系统")
    DEBUG: bool = os.getenv("DEBUG", "False").lower() == "true"
    
    # 数据库配置
    DATABASE_URL: str = os.getenv("DATABASE_URL", "mysql+pymysql://user:password@localhost:3306/mydatabase")
    
    # MySQL 连接池配置
    DB_POOL_SIZE: int = int(os.getenv("DB_POOL_SIZE", "10"))
    DB_MAX_OVERFLOW: int = int(os.getenv("DB_MAX_OVERFLOW", "20"))
    DB_POOL_TIMEOUT: int = int(os.getenv("DB_POOL_TIMEOUT", "30"))
    DB_POOL_RECYCLE: int = int(os.getenv("DB_POOL_RECYCLE", "1800"))
    DB_POOL_PRE_PING: bool = os.getenv("DB_POOL_PRE_PING", "True").lower() == "true"
    
    # 安全配置
    SECRET_KEY: str = os.getenv("SECRET_KEY", "your-secret-key-change-in-production")
    ALGORITHM: str = os.getenv("ALGORITHM", "HS256")
    ACCESS_TOKEN_EXPIRE_MINUTES: int = int(os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", "30"))
    
    # 其他配置
    PROJECT_NAME: str = os.getenv("PROJECT_NAME", "KeywordMatchSystem")

settings = Settings()
